import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
const VueRouterPush = VueRouter.prototype.push 
VueRouter.prototype.push = function push (to) {
    return VueRouterPush.call(this, to).catch(err => err)
}

const routes = [
  {
    path: '/',
    redirect: '/index/TodoList/1-1-1',
  },
  {
    path: '/login',
    component: ()=>import('../views/login/Login.vue')
  },
  {
    path: '/index',
    redirect: '/index/TodoList/1-1-1',//设置默认子路由
    component: ()=>import('../components/basicLayout/NavLayout'),
    children: [
      {
        path: 'TodoList/:path',
        component: ()=>import('../components/todoList/TodoList'),
        props: true
      },
      {
        path: '/home',
        component: ()=>import('../views/home/Home.vue')
      },
    ]
  },  
]

const router = new VueRouter({
  routes
})

export default router
